﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SEVN.Web.Framework.Modules.Menu
{
    public partial class Menu0501 : System.Web.UI.UserControl
    {
        WebFrameDataContext dt = new WebFrameDataContext();
        protected void Page_Load(object sender, EventArgs e)
        {
            RPTMenu0501.DataSource = dt.Categories.Where(category => category.CategoryParentID == 0);

            RPTMenu0501.DataBind();
        }

        protected void RPTMenu0501_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            HiddenField hf = (HiddenField)e.Item.FindControl("hf");
            Repeater rptcon1 = (Repeater)e.Item.FindControl("rptcon");
            if (hf != null && rptcon1 != null)
            {
                //var list = from x in dt.Categories
                //           where x.CategoryParentID.ToString() == hf.Value
                //           select x;
                //rptcon1.DataSource = list;
                //rptcon1.DataBind();
                rptcon1.DataSource = dt.Categories.Where(c => c.CategoryParentID.ToString() == hf.Value);
                rptcon1.DataBind();
            }
        }
    }
}